package ge.telasi.tasks.ui.reporting;

import ge.telasi.tasks.ui.comp.CalendarField;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.util.Calendar;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 * @author dimitri
 */
public class TaskCompReportParams extends JPanel {

    private CalendarField fldStartDate = new CalendarField();
    private CalendarField fldEndDate = new CalendarField();

    public TaskCompReportParams() {
        initUI();
        Calendar c1 = Calendar.getInstance();
        c1.add(Calendar.YEAR, -1);
        Calendar c2 = Calendar.getInstance();
        fldStartDate.setDate(c1);
        fldEndDate.setDate(c2);
    }

    private void initUI() {
        setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        setLayout(new GridBagLayout());
        GridBagConstraints c1 = new GridBagConstraints();
        GridBagConstraints c2 = new GridBagConstraints();
        c1.gridx = 0;
        c2.gridx = 1;
        c2.weightx = 1;
        c2.anchor = GridBagConstraints.FIRST_LINE_START;
        c1.insets = c2.insets = new Insets(5, 5, 5, 5);
        add(new JLabel("საწყისი თარიღი"), c1);
        add(fldStartDate, c2);
        add(new JLabel("საბოლოო თარიღი"), c1);
        add(fldEndDate, c2);
    }

    public Calendar getStartDate() {
        return  fldStartDate.getDate();
    }

    public Calendar getEndDate() {
        return  fldEndDate.getDate();
    }

}
